package inter

import (
	"gamesdk/clock"
	"time"
)

type ReciveMsg func(mainCmd int32, subCmd int32, buffer []byte)
type Exit func()

//通讯接口
type InteClient interface {
	Start(reciveMsg ReciveMsg, exit Exit)
	SendMsgToClinet(message []byte)
	SendMsgToServer(message []byte)
	GetIp() string
	Exit()
}

// //AI通讯接口
// type InteAIClient interface {
// 	//发送消息到服务器
// 	SendMsgToServer(message []byte)
// 	//添加定时器
// 	AddTimer(actionInterval time.Duration, jobFunc func()) (job clock.Job, ok bool)
// 	//添加定时器
// 	AddTimerRepeat(interval time.Duration, actionMax uint64, jobFunc func()) (jobScheduled clock.Job, inserted bool)
// }

/*
*定义一个服务接口对象
 */
type Server interface {
	Accept(cli InteClient) //接受到链接
	Exit()                 //服务退出需要做的处理
}

//AI管理接口
type InterAIManager interface {
	OnSendMsgToClient(cli InteClient, buff []byte)
	//添加定时器
	AddTimer(actionInterval time.Duration, jobFunc func()) (job clock.Job, ok bool)
	//添加定时器
	AddTimerRepeat(interval time.Duration, actionMax uint64, jobFunc func()) (jobScheduled clock.Job, inserted bool)
	//用户退出
	Exit(cli InteClient)
}
